import { request } from '@/utils';

/**
 * 红包活动信息
 * @param {*} data
 * activityId 活动id
 */
export function activityInfo(data, showLoading) {
  return request({
    url: `/activity/packet/info`,
    method: 'post',
    showLoading: !!showLoading,
    data,
  });
}
/**
 * 统计活动点击次数
 * @param {*} data
 * activityId 活动id
 */
export function packetClick(activityId) {
  return request({
    url: `/activity/packet/click/${activityId}`,
    method: 'get',
    showLoading: false,
  });
}
/**
 * 生成分享图片
 * @param {*} data
 * activityId 活动id
 */
export function generateShareImg(data) {
  return request({
    url: `/activity/packet/generate-img`,
    method: 'post',
    // showLoading: false,
    data,
  });
}
/**
 * 拆红包
 * @param {*} data
 * username
 */
export function getPacketInfo(data) {
  return request({
    url: `/activity/packet/open`,
    method: 'put',
    data,
    showDialog: false, // 当接口response的code不是200时，不显示默认弹框
  });
}
/**
 * 统计活动分享次数
 * @param {*} id
 * username
 */
export function shareActivity(id, inviteUserId, inviteType) {
  return request({
    url: `/activity/packet/share/${id}/${inviteUserId || 0}/${inviteType || 0}`,
    method: 'get',
    showDialog: false,
  });
}

/**
 * 获取我的邀请统计信息
 * @param {*} data
 * activityId 活动id
 */
export function myInviteCount(activityId) {
  return request({
    url: `/activity/packet/my-invite/${activityId}`,
    method: 'get',
  });
}
/**
 * 获取我的邀请列表
 * @param {*} data
 * activityId 活动id
 * pageNum 当前页，默认1
 * pageSize 每页显示条数，默认 10
 */
export function inviteList(data) {
  return request({
    url: `/activity/packet/my-invite-page`,
    method: 'post',
    data,
  });
}
/**
 * 我的红包领取记录
 * @param {*} data
 * activityId 活动id
 * pageNum 当前页，默认1
 * pageSize 每页显示条数，默认 10
 */
export function pageMyReceive(data) {
  return request({
    url: `/activity/packet/pageMyReceive`,
    method: 'post',
    data,
  });
}
/**
 * 我的红包领取统计
 * @param {*} data
 * activityId 活动id
 */
export function totalMyReceive(activityId) {
  return request({
    url: `/activity/packet/totalMyReceive/${activityId}`,
    method: 'get',
  });
}

/**
 * 获取投诉原因列表
 * @param {*} void
 */
export function suggestionsList() {
  return request({
    url: `/suggestions/reason/list`,
    method: 'get',
  });
}

/**
 * 获取投诉原因列表
 * @param {*} data
 * activityId 活动id
 * content 当前页，默认1
 */
export function suggestionSubmit(data) {
  return request({
    url: `/suggestions/record/submit`,
    method: 'post',
    data,
  });
}
